How to change mod_rewrite to avoid {REQUEST_FILENAME} in order to get around 255 character URL limit?
Posted
by
Jeremy Reimer
on Server Fault
See other posts from Server Fault
or by Jeremy Reimer
Published on 2011-11-23T00:30:53Z
Indexed on
2011/11/23
1:58 UTC
Read the original article
Hit count: 508
apache2
|mod-rewrite
According to this answer: max length of url 257 characters for mod_rewrite? there is a maximum 255 character hard limit based on the file system for using mod_rewrite.
According to the accepted answer, there are two solutions:
- Change the URL format of your application to a max of 255 characters between each slash.
- Move the Rewrite rules into the apache virtual host config and remove the REQUEST_FILENAME.
I cannot use the first method, so I am trying to figure out the second.
I have put the Rewrite rules into the Apache virtual host config as requested. However I cannot figure out how to remove the REQUEST_FILENAME and still have my web application framework (Dragonfly) still work.
Here is the portion of the rewrite rules that I moved from .htaccess into the virtual host config file of Apache:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f [OR]
# if don't want Dragonfly to process html files comment
# out the line below (you may need to remove the [OR] above too).
RewriteCond %{REQUEST_FILENAME} \.(html|nl)$
# Main URL rewriting.
RewriteRule (.*) index.cgi?$1 [L,QSA]
I've tried removing {REQUEST_FILENAME} and it just breaks the framework in various ways. How do I rewrite this without using {REQUEST_FILENAME}?
© Server Fault or respective owner